package com.lagou;

import com.lagou.bean.Resume;
import com.lagou.repository.ResumeRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;



@SpringBootApplication
public class MongoTemplateMain {
    public static void main(String[] args) {
        /*ClassPathXmlApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("applicationContext.xml");*/
        ConfigurableApplicationContext applicationContext = SpringApplication.run(MongoTemplateMain.class, args);
        ResumeRepository resumeRepository = applicationContext.getBean(ResumeRepository.class);
        /*Resume resume  = new Resume();
        resume.setName("lisi");
        resume.setCity("北京");
        Date date = null;
        String  dateStr = "yyyy-MM-dd hh:mm:ss";
        SimpleDateFormat simpleDateFormat  = new SimpleDateFormat(dateStr);
        try {
            date = simpleDateFormat.parse("2003-10-02 11:13:14");
        } catch (Exception e) {
            e.printStackTrace();
        }
        resume.setBirthday(date);
        resume.setExpectSalary(28000);
        resumeDao.insertResume(resume);
        System.out.println("*********************resume"+resume);*/

      /*  Resume resume  =resumeDao.findByName("lisi");
        System.out.println(resume);
        List<Resume> datas = resumeDao.findList("zhangsan");
        System.out.println(datas);
        List<Resume> datas2 = resumeDao.findListByNameAndExpectSalary("zhangsan",25000);
        System.out.println(datas2);*/
      /*  System.out.println(resumeRepository.findAll());
        System.out.println(resumeRepository.findByNameEquals("lisi"));
        System.out.println(resumeRepository.findByNameAndExpectSalary("lisi",28000));*/
       /* for (int i = 0; i < 10; i++) {
            Resume resume  = new Resume();
            resume.setName("chengdaotest"+i);
            resume.setExpectSalary(1);
            resume.setCity("bj");
            resumeRepository.save(resume);
        }*/
       /* Resume resume  = new Resume();
        resume.setName("chengdaotest");
        resume.setExpectSalary(1);
        resume.setCity("bj");
        resumeRepository.save(resume);
*/
       System.out.println(resumeRepository.findAll());



    }
}
